import { Module } from 'vuex'
import { RootState } from '../index'

export interface i18nState {
  language: string
}

export const i18n: Module<i18nState, RootState> = {
  namespaced: true,
  state: {
    language: 'zh' // 保存当前语言，防止刷新后重置，默认为中文
  },
  mutations: {
    // 保存当前语言
    SET_LANGUAGE: (state, str) => {
      state.language = str
    }
  }
}
